package com.yanqu.road.entity.activity;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.Objects;

public class UserActivityConditionData extends DataObject {

	private long userId;

	private int activityId;

	private int conditionId;
	/**
	 * 之前的值，用来存储冲榜之前的值
	 */
	private BigInteger preValue = BigInteger.valueOf(-1L);

	private BigInteger value = BigInteger.ZERO;

	private boolean isGetReward;

	private long modifyTime;

	private String param = "";

	private int type;

	private String unionUid = "";   //缓存数据，不入库

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		if (this.userId != userId) {
			this.userId = userId;
			setUpdateOption();
		}
	}

	public int getActivityId() {
		return activityId;
	}

	public void setActivityId(int activityId) {
		if (this.activityId != activityId) {
			this.activityId = activityId;
			setUpdateOption();
		}
	}

	public int getConditionId() {
		return conditionId;
	}

	public void setConditionId(int conditionId) {
		if (this.conditionId != conditionId) {
			this.conditionId = conditionId;
			setUpdateOption();
		}
	}

	public BigInteger getPreValue() {
		return preValue;
	}

	public void setPreValue(BigInteger preValue) {
		if (!Objects.equals(this.preValue, preValue)) {
			this.preValue = preValue;
			setUpdateOption();
		}
	}

	public BigInteger getValue() {
		return value;
	}

	public void setValue(BigInteger value) {
		if (!Objects.equals(this.value, value)) {
			this.value = value;
			setUpdateOption();
		}
	}

	public boolean isGetReward() {
		return isGetReward;
	}

	public void setGetReward(boolean isGetReward) {
		if (this.isGetReward != isGetReward) {
			this.isGetReward = isGetReward;
			setUpdateOption();
		}
	}

	public long getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(long modifyTime) {
		if(this.modifyTime != modifyTime) {
			this.modifyTime = modifyTime;
			setUpdateOption();
		}
	}

	public String getParam() {
		return param;
	}

	public void setParam(String param) {
		if(!Objects.equals(this.param, param)) {
			this.param = param;
			setUpdateOption();
		}
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		if(this.type != type) {
			this.type = type;
			setUpdateOption();
		}
	}

	public String getUnionUid() {
		return unionUid;
	}

	public void setUnionUid(String unionUid) {
		this.unionUid = unionUid;
	}

	/**
	 * 是否是初始值
	 * @return
	 */
	public boolean isInitData() {
		if (preValue.equals(BigInteger.valueOf(-1L)) && value.equals(BigInteger.ZERO) && StringUtils.isNullOrEmpty(param) && !isGetReward) {
			return true;
		}
		return false;
	}
}
